<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>当当购物车</title>
    <link rel="stylesheet" href="./css/cart.css">
    <script src="./js/vue.global.js"></script>
    <script src="./js/vuex.global.js"></script>
</head>

<body>
    <div class="container" id="root">
        <div class="logo">
            <img src="./image/dd_logo.jpg" alt="logo"><button @click="onShowHide" class="product-add">添加商品</button>
        </div>
        <!-- 购物车列表组件 -->
        <product-list></product-list>
        <!-- 添加购物车组件 -->
        <product-add></product-add>
    </div>

    <script type="module">
        import productList from './js/productList.js'
        import productAdd from './js/productAdd.js'
        import store from './js/store.js'

        const app = Vue.createApp({
            methods: {
                onShowHide() {
                    this.$store.dispatch('setShow')
                },
            }
        })
        app.use(store)
        app.component('productList', productList)
        app.component('productAdd', productAdd)
        app.mount('#root')

    </script>
</body>

</html>